﻿using AutoClub.Support;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AutoClub.Tests
{
    [TestClass]
    public class SpanBuilderTests
    {
        /// <summary>
        /// Test para la creacion de un span de primer nivel
        /// </summary>
        [TestMethod]
        public void SimpleSpanCreation()
        {
            //setup
            string cssClass = "myClass";
            SpanBuilder builder = new SpanBuilder(cssClass);

            //sut
            string result = builder.ToString();

            //asserts
            result.Should().NotBeNullOrEmpty("se espera un span html no nulo");
            result.Should().Be("<span class=\"myClass\"></span>", "error en el tag html generado");
        }

        /// <summary>
        /// Test para la creacioni de un span con spans de segundo nivel
        /// </summary>
        [TestMethod]
        public void NestedSpanCreation()
        {
            //setup
            string cssClass = "myClass";
            string nestedCssClass = "nestedCssClass";
            string nestedContent = "nestedContent";

            SpanBuilder builder = new SpanBuilder(cssClass);

            //sut
            builder.AddNestedSpan(nestedCssClass, nestedContent);
            string result = builder.ToString();

            //asserts
            result.Should().NotBeNullOrEmpty("se espera un span html no nulo");
            result.Should().Be("<span class=\"myClass\"><span class=\"nestedCssClass\">nestedContent</span></span>", "error en el tag html generado");
        }
    }
}
